"""author: mibo
   data: 2020/10/20
   project: pythonProject
"""
import random

def lixi():
    be = float(input("请输入你的本金： "))
    re = float(input("请输入你的目标金额： "))
    y = 0
    while be < re:
        y += 1
        li = be * 5 / 100 * y
        be += li

        print(f"第{y}年结束后的本金是{be}，利息是{li}")
    print(f"达成目标需要{y}年")


def pm():
    i = 0
    while i == 0:
        pm = int(input("请输入你想查询的PM2.5值: "))
        if 0 <=pm<= 50:
            print("今天的空气质量是优")
        elif 51 <= pm <= 100:
            print("今天的空气质量是良")
        elif 101<= pm <= 150:
            print("今天的空气质量是轻度污染")
        elif 151<= pm <= 200:
            print("今天的空气质量是中度污染")
        elif 201<= pm <= 300:
            print("今天的空气质量是重度污染")
        else:
            print("今天的空气质量是严重污染")
        end = input("输入Q结束查询")
        if end == "Q":
            i = 1

def denji():
    print("成绩查询；输入一个0-100的数字，查询你的成绩")
    grade = input("请输入你的成绩: ")
    if str.isnumeric(grade) != True:
        print("您输入的不是数字，请输入数字")
    elif int(grade) > 100:
        print("您输入的数大于100，请输入小于100的数")
    elif int(grade) < 0:
        print("您输入的数小于0，请输入大于0的数")
    elif 85<= int(grade) <= 100:
        print("您的成绩为优秀")
    elif 60 <=int(grade) < 85:
        print("您的成绩为良好")
    else:
        print("您的成绩为不及格")

def du():
    v = 0
    l = 0
    t = 1000
    print("猜大小游戏，请输入大或小猜测，输入exit退出")
    while 1:
        s = random.randint(1,6) + random.randint(1,6) + random.randint(1,6)
        print(s)
        q = input("请输入您的猜测结果")

        if (q == "大" and s >=11) or (q == "小" and s <=11):
            v += 1
            t += 100
            print(f"猜对啦！您的金豆剩余{t}个")

        else:
            l += 1
            t -= 100
            print(f"猜错啦！您的金豆剩余{t}个")

        if q == "exit" or t <= 100:
            print(f"游戏结束;您一共猜对{v}次，猜错{l}次，胜率是{v/(l+v)}")
            break

lixi()
pm()
denji()
du()